/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.openams.server.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mike
 */
@Entity
@Table(name = "datasetinstanceassignments")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DatasetInstanceAssignment.findAll", query = "SELECT d FROM DatasetInstanceAssignment d"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByDatasetInstanceAssignmentID", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.datasetInstanceAssignmentID = :datasetInstanceAssignmentID"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByEffectiveDate", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.effectiveDate = :effectiveDate"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByExpiryDate", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.expiryDate = :expiryDate"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByNumericVal", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.numericVal = :numericVal"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByTinyStringVal", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.tinyStringVal = :tinyStringVal"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByMediumStringVal", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.mediumStringVal = :mediumStringVal"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByBigStringVal", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.bigStringVal = :bigStringVal"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByDateVal", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.dateVal = :dateVal"),
    @NamedQuery(name = "DatasetInstanceAssignment.findByBooleanVal", query = "SELECT d FROM DatasetInstanceAssignment d WHERE d.booleanVal = :booleanVal")})
public class DatasetInstanceAssignment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "DatasetInstanceAssignmentID", nullable = false)
    private Long datasetInstanceAssignmentID;
    @Column(name = "EffectiveDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date effectiveDate;
    @Column(name = "ExpiryDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date expiryDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "NumericVal", precision = 15, scale = 6)
    private BigDecimal numericVal;
    @Size(max = 16)
    @Column(name = "TinyStringVal", length = 16)
    private String tinyStringVal;
    @Size(max = 64)
    @Column(name = "MediumStringVal", length = 64)
    private String mediumStringVal;
    @Size(max = 1024)
    @Column(name = "BigStringVal", length = 1024)
    private String bigStringVal;
    @Column(name = "DateVal")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateVal;
    @Column(name = "BooleanVal")
    private Boolean booleanVal;
    @Lob
    @Column(name = "BlobVal")
    private byte[] blobVal;
    @JoinColumn(name = "ReferenceDatasetInstanceHierarchyID", referencedColumnName = "DatasetInstanceHierarchyID")
    @ManyToOne(fetch = FetchType.LAZY)
    private DatasetInstanceHierarchy referenceDatasetInstanceHierarchyID;
    @JoinColumn(name = "DatasetTemplateAssignmentID", referencedColumnName = "DatasetTemplateAssignmentID")
    @ManyToOne(fetch = FetchType.LAZY)
    private DatasetTemplateAssignment datasetTemplateAssignmentID;
    @JoinColumn(name = "MetaDatasetInstanceID", referencedColumnName = "DatasetInstanceID")
    @ManyToOne(fetch = FetchType.LAZY)
    private DatasetInstance metaDatasetInstanceID;
    @JoinColumn(name = "DatasetInstanceID", referencedColumnName = "DatasetInstanceID")
    @ManyToOne(fetch = FetchType.LAZY)
    private DatasetInstance datasetInstanceID;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "datasetInstanceAssignment", fetch = FetchType.LAZY)
    private DiscretAssetAssignment discretAssetAssignment;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "datasetInstanceAssignment", fetch = FetchType.LAZY)
    private LinearAssetAssignment linearAssetAssignment;

    public DatasetInstanceAssignment() {
    }

    public DatasetInstanceAssignment(Long datasetInstanceAssignmentID) {
        this.datasetInstanceAssignmentID = datasetInstanceAssignmentID;
    }

    public Long getDatasetInstanceAssignmentID() {
        return datasetInstanceAssignmentID;
    }

    public void setDatasetInstanceAssignmentID(Long datasetInstanceAssignmentID) {
        this.datasetInstanceAssignmentID = datasetInstanceAssignmentID;
    }

    public Date getEffectiveDate() {
        return effectiveDate;
    }

    public void setEffectiveDate(Date effectiveDate) {
        this.effectiveDate = effectiveDate;
    }

    public Date getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(Date expiryDate) {
        this.expiryDate = expiryDate;
    }

    public BigDecimal getNumericVal() {
        return numericVal;
    }

    public void setNumericVal(BigDecimal numericVal) {
        this.numericVal = numericVal;
    }

    public String getTinyStringVal() {
        return tinyStringVal;
    }

    public void setTinyStringVal(String tinyStringVal) {
        this.tinyStringVal = tinyStringVal;
    }

    public String getMediumStringVal() {
        return mediumStringVal;
    }

    public void setMediumStringVal(String mediumStringVal) {
        this.mediumStringVal = mediumStringVal;
    }

    public String getBigStringVal() {
        return bigStringVal;
    }

    public void setBigStringVal(String bigStringVal) {
        this.bigStringVal = bigStringVal;
    }

    public Date getDateVal() {
        return dateVal;
    }

    public void setDateVal(Date dateVal) {
        this.dateVal = dateVal;
    }

    public Boolean getBooleanVal() {
        return booleanVal;
    }

    public void setBooleanVal(Boolean booleanVal) {
        this.booleanVal = booleanVal;
    }

    public byte[] getBlobVal() {
        return blobVal;
    }

    public void setBlobVal(byte[] blobVal) {
        this.blobVal = blobVal;
    }

    public DatasetInstanceHierarchy getReferenceDatasetInstanceHierarchyID() {
        return referenceDatasetInstanceHierarchyID;
    }

    public void setReferenceDatasetInstanceHierarchyID(DatasetInstanceHierarchy referenceDatasetInstanceHierarchyID) {
        this.referenceDatasetInstanceHierarchyID = referenceDatasetInstanceHierarchyID;
    }

    public DatasetTemplateAssignment getDatasetTemplateAssignmentID() {
        return datasetTemplateAssignmentID;
    }

    public void setDatasetTemplateAssignmentID(DatasetTemplateAssignment datasetTemplateAssignmentID) {
        this.datasetTemplateAssignmentID = datasetTemplateAssignmentID;
    }

    public DatasetInstance getMetaDatasetInstanceID() {
        return metaDatasetInstanceID;
    }

    public void setMetaDatasetInstanceID(DatasetInstance metaDatasetInstanceID) {
        this.metaDatasetInstanceID = metaDatasetInstanceID;
    }

    public DatasetInstance getDatasetInstanceID() {
        return datasetInstanceID;
    }

    public void setDatasetInstanceID(DatasetInstance datasetInstanceID) {
        this.datasetInstanceID = datasetInstanceID;
    }

    public DiscretAssetAssignment getDiscretAssetAssignment() {
        return discretAssetAssignment;
    }

    public void setDiscretAssetAssignment(DiscretAssetAssignment discretAssetAssignment) {
        this.discretAssetAssignment = discretAssetAssignment;
    }

    public LinearAssetAssignment getLinearAssetAssignment() {
        return linearAssetAssignment;
    }

    public void setLinearAssetAssignment(LinearAssetAssignment linearAssetAssignment) {
        this.linearAssetAssignment = linearAssetAssignment;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (datasetInstanceAssignmentID != null ? datasetInstanceAssignmentID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DatasetInstanceAssignment)) {
            return false;
        }
        DatasetInstanceAssignment other = (DatasetInstanceAssignment) object;
        if ((this.datasetInstanceAssignmentID == null && other.datasetInstanceAssignmentID != null) || (this.datasetInstanceAssignmentID != null && !this.datasetInstanceAssignmentID.equals(other.datasetInstanceAssignmentID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.openams.server.entity.DatasetInstanceAssignment[ datasetInstanceAssignmentID=" + datasetInstanceAssignmentID + " ]";
    }
    
}
